// 待办列表
var thingsGridColumns = [{
    id: 'title',
    title: '标题',
    width: 200,
    type: 'string',
    columnClass: 'text-center',
  },
  {
    id: 'content',
    title: '主要内容',
    type: 'string',
    columnClass: 'text-left',
  },
  {
    id: 'userName',
    title: '发起人',
    type: 'string',
    width: 80,
    columnClass: 'text-center',
  },
  {
    id: 'time',
    title: '提交时间',
    type: 'date',
    width: 100,
    format: 'yyyy-MM-dd',
    columnClass: 'text-center',
    hideType: 'lg|md|sm|xs',
  },
  {
    id: 'operation',
    title: '操作',
    width: 100,
    type: 'string',
    columnClass: 'text-center',
    resolution: function (value, record, column, grid, dataNo, columnNo) {
      var content = '';
      content += '<button class="btn btn-xs btn-success" onclick="toDo(' + record.id + ',' + record.doType + ');"><i class="fa fa-edit"></i>  待办</button>';
      return content;
    }
  }
];
var thingsGridOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  // loadURL:'url',
  // check: true,
  // checkWidth: '37px',
  exportFileName: '事项列表',
  datas: [{
    id: 1,
    title: '线索申请',
    userName: '张三测试',
    content: '新增线索申请后的批准操作',
    time: '9999-99-99',
    doType: 1,
  }, {
    id: 2,
    title: '线索申请',
    userName: '张三测试',
    content: '线索申请被退回后的操作',
    time: '9999-99-99',
    doType: 2,
  }, {
    id: 3,
    title: '线索申请',
    userName: '张三测试',
    content: '线索申请批准后的结果',
    time: '9999-99-99',
    doType: 3,
  }, {
    id: 4,
    title: '立项申请',
    userName: '张三测试',
    content: '新增立项申请后的批准操作（勾选了项目经理）',
    time: '9999-99-99',
    doType: 4,
  }, {
    id: 5,
    title: '立项申请',
    userName: '张三测试',
    content: '新增立项申请后的批准操作（没有勾选项目经理）',
    time: '9999-99-99',
    doType: 5,
  }, {
    id: 6,
    title: '立项申请',
    userName: '张三测试',
    content: '立项申请批准通过后的操作（填写商务预测信息）',
    time: '9999-99-99',
    doType: 6,
  }, {
    id: 7,
    title: '立项申请',
    userName: '张三测试',
    content: '立项申请被退回后的操作（不包含商务预测）',
    time: '9999-99-99',
    doType: 7,
  }, {
    id: 8,
    title: '立项申请',
    userName: '张三测试',
    content: '立项申请被退回后的操作（包含商务预测）',
    time: '9999-99-99',
    doType: 8,
  }, {
    id: 9,
    title: '立项申请',
    userName: '张三测试',
    content: '立项申请批准后的结果（包含商务预测）',
    time: '9999-99-99',
    doType: 9,
  }, {
    id: 10,
    title: '立项申请',
    userName: '张三测试',
    content: '立项申请批准后的结果（不包含商务预测）',
    time: '9999-99-99',
    doType: 10,
  }, {
    id: 11,
    title: '投标申请',
    userName: '张三测试',
    content: '新增投标申请后的批准操作',
    time: '9999-99-99',
    doType: 11,
  }, {
    id: 12,
    title: '投标申请',
    userName: '张三测试',
    content: '投标申请被退回的操作',
    time: '9999-99-99',
    doType: 12,
  }, {
    id: 13,
    title: '投标申请',
    userName: '张三测试',
    content: '投标申请批准结果的操作',
    time: '9999-99-99',
    doType: 13,
  }, {
    id: 14,
    title: '投标申请',
    userName: '张三测试',
    content: '投标审批批准通过后的商务信息文件的上传操作',
    time: '9999-99-99',
    doType: 14,
  }, {
    id: 15,
    title: '投标申请',
    userName: '张三测试',
    content: '投标审批批准通过后的法务合同文件的上传操作',
    time: '9999-99-99',
    doType: 15,
  }, {
    id: 16,
    title: '投标申请',
    userName: '张三测试',
    content: '投标审批批准通过后的技术方案文件的上传操作',
    time: '9999-99-99',
    doType: 16,
  }, {
    id: 17,
    title: '投标申请',
    userName: '张三测试',
    content: '投标审批批准通过后的交付方案文件的上传操作',
    time: '9999-99-99',
    doType: 17,
  }, {
    id: 18,
    title: '投标申请',
    userName: '张三测试',
    content: '投标商务信息文件的批准操作',
    time: '9999-99-99',
    doType: 18,
  }, {
    id: 19,
    title: '投标申请',
    userName: '张三测试',
    content: '投标法务合同文件的批准操作',
    time: '9999-99-99',
    doType: 19,
  }, {
    id: 20,
    title: '投标申请',
    userName: '张三测试',
    content: '投标技术方案文件的批准操作',
    time: '9999-99-99',
    doType: 20,
  }, {
    id: 21,
    title: '投标申请',
    userName: '张三测试',
    content: '投标交付方案文件的批准操作',
    time: '9999-99-99',
    doType: 21,
  }, {
    id: 22,
    title: '投标申请',
    userName: '张三测试',
    content: '投标商务信息文件被退回操作',
    time: '9999-99-99',
    doType: 22,
  }, {
    id: 23,
    title: '投标申请',
    userName: '张三测试',
    content: '投标法务合同文件被退回操作',
    time: '9999-99-99',
    doType: 23,
  }, {
    id: 24,
    title: '投标申请',
    userName: '张三测试',
    content: '投标技术方案文件被退回操作',
    time: '9999-99-99',
    doType: 24,
  }, {
    id: 25,
    title: '投标申请',
    userName: '张三测试',
    content: '投标交付方案文件被退回操作',
    time: '9999-99-99',
    doType: 25,
  }, {
    id: 26,
    title: '投标申请',
    userName: '张三测试',
    content: '投标申请综合审批的操作',
    time: '9999-99-99',
    doType: 26,
  }, {
    id: 27,
    title: '投标申请',
    userName: '张三测试',
    content: '投标申请综合审批结果的展示',
    time: '9999-99-99',
    doType: 27,
  }, {
    id: 28,
    title: '投标申请',
    userName: '张三测试',
    content: '投标申请综合审批通过销售领导审批的操作',
    time: '9999-99-99',
    doType: 28,
  }, {
    id: 29,
    title: '投标申请',
    userName: '张三测试',
    content: '投标申请综合审批通过销售领导审批被退回的操作',
    time: '9999-99-99',
    doType: 29,
  }, {
    id: 30,
    title: '投标申请',
    userName: '张三测试',
    content: '投标申请综合审批通过销售领导审批结果的操作',
    time: '9999-99-99',
    doType: 30,
  }, {
    id: 31,
    title: '商务报价申请',
    userName: '张三测试',
    content: '新增商务报价申请批准的操作',
    time: '9999-99-99',
    doType: 31,
  }, {
    id: 32,
    title: '商务报价申请',
    userName: '张三测试',
    content: '商务报价申请批准被退回的操作',
    time: '9999-99-99',
    doType: 32,
  }, {
    id: 33,
    title: '商务报价申请',
    userName: '张三测试',
    content: '商务报价申请批准结果的操作',
    time: '9999-99-99',
    doType: 33,
  }, ],
  columns: thingsGridColumns,
  gridContainer: 'thingsDataGird',
  toolbarContainer: 'thingsGridToolBarContainer',
  tools: '',
  extraWidth: 20,
  pageSize: 10,
  pageSizeLimit: [10, 20]
};
var thingsGird = $.fn.dlshouwen.grid.init(thingsGridOption);
$(function () {
  thingsGird.load();
});
// 待办类型跳转
function toDo(id, doType) {
  if (doType == 1) {
    window.location.href = "../../do/edit/edit-do-1.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 2) {
    window.location.href = "../../do/edit/edit-do-2.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 3) {
    window.location.href = "../../do/edit/edit-do-3.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 4) {
    window.location.href = "../../do/edit/edit-do-4.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 5) {
    window.location.href = "../../do/edit/edit-do-5.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 6) {
    window.location.href = "../../do/edit/edit-do-6.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 7) {
    window.location.href = "../../do/edit/edit-do-7.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 8) {
    window.location.href = "../../do/edit/edit-do-8.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 9) {
    window.location.href = "../../do/edit/edit-do-9.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 10) {
    window.location.href = "../../do/edit/edit-do-10.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 11) {
    window.location.href = "../../do/edit/edit-do-11.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 12) {
    window.location.href = "../../do/edit/edit-do-12.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 13) {
    window.location.href = "../../do/edit/edit-do-13.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 14) {
    window.location.href = "../../do/edit/edit-do-14.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 15) {
    window.location.href = "../../do/edit/edit-do-15.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 16) {
    window.location.href = "../../do/edit/edit-do-16.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 17) {
    window.location.href = "../../do/edit/edit-do-17.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 18) {
    window.location.href = "../../do/edit/edit-do-18.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 19) {
    window.location.href = "../../do/edit/edit-do-19.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 20) {
    window.location.href = "../../do/edit/edit-do-20.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 21) {
    window.location.href = "../../do/edit/edit-do-21.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 22) {
    window.location.href = "../../do/edit/edit-do-22.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 23) {
    window.location.href = "../../do/edit/edit-do-23.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 24) {
    window.location.href = "../../do/edit/edit-do-24.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 25) {
    window.location.href = "../../do/edit/edit-do-25.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 26) {
    window.location.href = "../../do/edit/edit-do-26.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 27) {
    window.location.href = "../../do/edit/edit-do-27.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 28) {
    window.location.href = "../../do/edit/edit-do-28.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 29) {
    window.location.href = "../../do/edit/edit-do-29.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 30) {
    window.location.href = "../../do/edit/edit-do-30.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 31) {
    window.location.href = "../../do/edit/edit-do-31.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 32) {
    window.location.href = "../../do/edit/edit-do-32.html" + '?id=' + id + '&doType=' + doType;
  }
  if (doType == 33) {
    window.location.href = "../../do/edit/edit-do-33.html" + '?id=' + id + '&doType=' + doType;
  }
}
//文件下载权限申请
$(".download-icon").on('click', function () {
  //询问框
  layer.confirm('权限不足，是否申请更高权限？', {
    title: '提示信息',
    btn: ['申请', '取消'] //按钮
  }, function () {
    layer.msg('申请成功', {
      icon: 1
    });
  });
});
// 立项选择展示隐藏效果
$('#remember').change(function () {
  var status = $('#remember').prop("checked");
  if (status) {
    $('.hideprobox').show()
  } else {
    $('.hideprobox').hide()
  }
});
// 立项信息-项目指标
var proinColumns = [{
  id: 'indName',
  title: '指标名称',
  width: 160,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'indMsg',
  title: '指标描述',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'indTime',
  title: '完成时间',
  type: 'string',
  width: 100,
  columnClass: 'text-left',
}, ];
var proinOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '项目指标',
  datas: [{
    indName: '指标名称测试数据',
    indMsg: '指标描述测试数据',
    indTime: '9999-99-99',
  }, ],
  columns: proinColumns,
  gridContainer: 'proinContainer',
  toolbarContainer: 'proinToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var proinGrid = $.fn.dlshouwen.grid.init(proinOption);
$(function () {
  proinGrid.load();
});
// 立项信息-其他费用
var otherColumns = [{
  id: 'things',
  title: '事由',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'amount',
  title: '预算金额',
  width: 200,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '￥' + value + '元';
    return content;
  }
}, ];
var otherOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '其他费用',
  datas: [{
    things: 'XXXXXX费用支出测试数据',
    amount: '￥299929.99',
  }, ],
  columns: otherColumns,
  gridContainer: 'otherContainer',
  toolbarContainer: 'otherToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var otherGrid = $.fn.dlshouwen.grid.init(otherOption);
$(function () {
  otherGrid.load();
});
// 立项信息-其他费用
var other1Columns = [{
  id: 'things',
  title: '事由',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'amount',
  title: '预算金额',
  width: 200,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '￥' + value + '元';
    return content;
  }
}, {
  id: 'operation',
  title: '操作',
  type: 'string',
  width: 150,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-info" onclick="layer.msg(\'编辑：' + record.things + '信息\');"><i class="fa fa-edit"></i>  编辑</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-danger" onclick="layer.msg(\'删除：' + record.things + '信息\');"><i class="fa fa-trash-o"></i>  删除</button>';
    return content;
  }
}];
var other1Option = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '其他费用',
  datas: [{
    things: 'XXXXXX费用支出测试数据',
    amount: '￥299929.99',
  }, ],
  columns: other1Columns,
  gridContainer: 'other1Container',
  toolbarContainer: 'other1ToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var other1Grid = $.fn.dlshouwen.grid.init(other1Option);
$(function () {
  other1Grid.load();
});
// 立项信息-项目指标
var proin1Columns = [{
  id: 'indName',
  title: '指标名称',
  width: 160,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'indMsg',
  title: '指标描述',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'indTime',
  title: '完成时间',
  type: 'string',
  width: 100,
  columnClass: 'text-left',
}, {
  id: 'operation',
  title: '操作',
  width: 150,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-info" onclick="layer.msg(\'编辑：' + record.indName + '信息\');"><i class="fa fa-edit"></i>  编辑</button>';
    content += '  ';
    content += '<button class="btn btn-xs btn-danger" onclick="layer.msg(\'删除：' + record.indName + '信息\');"><i class="fa fa-trash-o"></i>  删除</button>';
    return content;
  }
}];
var proin1Option = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '项目指标',
  datas: [{
    indName: '指标名称测试数据',
    indMsg: '指标描述测试数据',
    indTime: '9999-99-99',
  }, ],
  columns: proin1Columns,
  gridContainer: 'proin1Container',
  toolbarContainer: 'proin1ToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var proin1Grid = $.fn.dlshouwen.grid.init(proin1Option);
$(function () {
  proin1Grid.load();
});
//项目指标表单显示隐藏
function hideproin() {
  $(".hideproin").hide();
};

function showproin() {
  $(".hideproin").show();
};
//项目其他费用表单显示隐藏
function hideother() {
  $(".hideother").hide();
};

function showother() {
  $(".hideother").show();
};
//时间控件
$('#datetime').datepicker({
  format: 'yyyy-mm-dd'
});
$('#datetime-1').datepicker({
  format: 'yyyy-mm-dd'
});
$('#datetime-2').datepicker({
  format: 'yyyy-mm-dd'
});
//文件上传统一字段
function showfile() {
  $(".hidefile").show();
}

function hidefile() {
  $(".hidefile").hide();
}
// 商务报价条目列表显示隐藏
function showprice() {
  $(".hideprice").show();
}

function hideprice() {
  $(".hideprice").hide();
}
// 商务报价-历史记录
var piclogColumns = [{
  id: 'time',
  title: '提交日期',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'subName',
  title: '提交人',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
}, {
  id: 'price',
  title: '商务报价总价',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '￥' + value + '元';
    return content;
  }
}, {
  id: 'buy',
  title: '商务信息预测',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'msg',
  title: '申请说明',
  type: 'string',
  columnClass: 'text-left',
}, {
  id: 'finish',
  title: '审批结果',
  type: 'finish',
  width: 100,
  codeTable: status,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    if (value == 0) {
      content += '<span style="background:#d9534f;padding:2px 10px;color:white;">未通过</span>';
    }
    if (value == 1) {
      content += '<span style="background:#5cb85c;padding:2px 10px;color:white;">已通过</span>';
    }
    return content;
  }
}, {
  id: 'operation',
  title: '报价文件',
  width: 100,
  type: 'string',
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '';
    content += '<button class="btn btn-xs btn-info" onclick="down(' + record.id + ');"><i class="icon-cloud-download"></i>  下载</button>';
    return content;
  }
}];
var piclogOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '商务报价-历史记录',
  datas: [{
    id: 1,
    time: '2019-01-09',
    subName: '张三',
    price: '￥222.00元',
    buy: '商务信息预测测试数据',
    msg: '申请说明测试数据',
    finish: 0,
  }, ],
  columns: piclogColumns,
  gridContainer: 'piclogContainer',
  toolbarContainer: 'piclogToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var piclogGrid = $.fn.dlshouwen.grid.init(piclogOption);
$(function () {
  piclogGrid.load();
});
// 商务报价
var priceColumns = [{
  id: 'type',
  title: '分类',
  width: 160,
  type: 'string',
  columnClass: 'text-center',
}, {
  id: 'liPrice',
  title: '目录价',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '￥' + value + '元';
    return content;
  }
}, {
  id: 'discount',
  title: '折扣率',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = value + '%';
    return content;
}
}, {
  id: 'discount1',
  title: '折后价',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '￥' + value + '元';
    return content;
  }
}, {
  id: 'discount2',
  title: '税率',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = value + '%';
    return content;
}
}, {
  id: 'fisPrice',
  title: '含税价',
  type: 'string',
  width: 100,
  columnClass: 'text-center',
  resolution: function (value, record, column, grid, dataNo, columnNo) {
    var content = '￥' + value + '元';
    return content;
  }
}, {
  id: 'test',
  title: '说明',
  type: 'string',
  columnClass: 'text-left',
}, ];
var priceOption = {
  lang: 'zh-cn',
  ajaxLoad: false,
  extraWidth: 20,
  // loadURL:'url',
  exportFileName: '商务报价',
  datas: [{
    type: '软件',
    liPrice: '￥222.00元',
    discount: '20%',
    discount1: '30%',
    discount2: '30%',
    fisPrice: '￥1111.00元',
    test: '说明测试数据'
  }, ],
  columns: priceColumns,
  gridContainer: 'priceContainer',
  toolbarContainer: 'priceToolBarContainer',
  tools: '',
  pageSize: 10,
  pageSizeLimit: [10, 15, 20]
};
var priceGrid = $.fn.dlshouwen.grid.init(priceOption);
$(function () {
  priceGrid.load();
});
//文件下载权限事件
function down(id) {
  //询问框
  layer.confirm('权限不足，是否申请更高权限？', {
    title: '提示信息',
    btn: ['申请', '取消'] //按钮
  }, function () {
    layer.msg('申请成功', {
      icon: 1
    });
  });
}